home *** CD-ROM | disk | FTP | other *** search
- Path: castle.nando.net!news
- From: actuary@nando.net (Bill McCarthy)
- Newsgroups: comp.lang.c
- Subject: Re: Storing C Functions In An Array?
- Date: 3 Apr 1996 15:32:52 GMT
- Organization: Nando.net Public Access
- Message-ID: <4ju5n4$pr7@castle.nando.net>
- References: <4jc1u7$5e9@infa.central.susx.ac.uk>
- Reply-To: actuary@nando.net (Bill McCarthy)
- NNTP-Posting-Host: grail1216.nando.net
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <4jc1u7$5e9@infa.central.susx.ac.uk>,
- tepd6@central.susx.ac.uk (George Rattray) writes:
-
- >Can someone help me, I'm trying to store functions in an array at
- >compile time. The following functions are defined as
- >
- > struct complex func(struct complex, CHNL);
- >
- >I want to store them in an array ch[N];
- >
- >Therefor using the function with an index as
- >
- > ret = ch[0](x,chnl);
-
- struct complex { int a; }; /* for test compile */
- typedef int CHNL; /* for test compile */
-
- struct complex funca(struct complex, CHNL);
- struct complex funcb(struct complex, CHNL);
-
- typedef struct complex FUNC( struct complex, CHNL );
-
- FUNC *ch[] = {funca, funcb};
-
- Bill McCarthy
- actuary@nando.net
- Wendell, NC USA
-
-